package  
{
	import flash.display.MovieClip;
	import flash.events.Event;
	/**
	 * ...
	 * @author Seven Gae
	 */
	public class Main extends MovieClip
	{
		public static var Self : Main;
		
		public var screen : MovieClip;
		
		//---------------//
		
		public var menu: Menu;
		
		public var gameState: GameState;
		public var oldGameState: GameState;
		
		
		//Jogo 100% Finalizado
		
		public function Main() 
		{
			Self = this;
			
			gameState = GameState.MENU;
			
			screen = new MovieClip();
			addChild(screen);
			
			addEventListener(Event.ENTER_FRAME, update);
			
			SoundManager.addSound(new SoundFundo(), "fundo");
			SoundManager.addSound(new SoundToin1(), "toin1");
			SoundManager.addSound(new SoundToin2(), "toin2");
			SoundManager.addSound(new SoundToin3(), "toin3");
			SoundManager.addSound(new SoundToin4(), "toin4");
			SoundManager.addSound(new SoundBatida(), "batida");
			SoundManager.addSound(new SoundPuff(), "puff");
			SoundManager.addSound(new SoundPerdeu(), "perdeu");
			SoundManager.addSound(new SoundGameLoop(), "gameLoop");
			SoundManager.addSound(new SoundVictory(), "victory");
			
			SoundManager.playLoopedSound("fundo");
		}
		
		public function update(Evento:Event):void
		{
			
			switch(gameState)
			{
				case GameState.MENU:
					if (menu)
					{
						menu.update();
					}
					else
					{
						menu = new Menu();
					}
					break;
					
				case GameState.GAME:
					LevelManager.update();
					break;
			}
			
			Particles.update();
			
			oldGameState = gameState;
		}
		
		
	}

}